//  Copyright (c) 2018-present, Cruise LLC
//
//  This source code is licensed under the Apache License, Version 2.0,
//  found in the LICENSE file in the root directory of this source tree.
//  You may not use this file except in compliance with the License.

@import "~webviz-core/src/styles/colors.module.scss";

$panelToolbarHeight: 26px;
$panelToolbarSpacing: 4px;

.iconContainer {
  padding-top: $panelToolbarSpacing;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin-left: $panelToolbarSpacing;
  flex-direction: row;
  min-height: $panelToolbarHeight - $panelToolbarSpacing;
  padding: 2px 2px 2px 6px;
  svg {
    font-size: 14px;
  }
}

.panelName {
  font-size: 10px;
  opacity: 0.5;
  margin-right: 4px;
}

.panelToolbarContainer {
  transition: transform 80ms ease-in-out, opacity 80ms ease-in-out;
  display: flex;
  flex: 0 0 auto;
  flex-direction: row;
  justify-content: flex-end;
  background-color: $toolbar-fixed;
  padding: $panelToolbarSpacing;

  &.floating {
    position: absolute;
    right: 0;
    // leave some room for possible scrollbar
    padding-right: 8px;
    top: 0;
    width: 100%;
    z-index: 5000;
    background-color: transparent;
    transform: translateY(-10px);
    pointer-events: none;
    opacity: 0;

    * {
      pointer-events: auto;
    }

    &.hasChildren {
      left: 0;
      background-color: $toolbar-fixed;
    }

    &:not(.hasChildren) .iconContainer {
      background-color: $dark3;
      border-radius: 4px;
      box-shadow: 0 6px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.2);
    }
  }

  &:not(.floating) {
    min-height: $panelToolbarHeight + $panelToolbarSpacing;
  }

  &.floatingShow {
    transform: translateY(0);
    opacity: 1;
  }
}

.icon,
.dragIcon {
  font-size: 14px;
  margin: 0 0.2em;
}

.dragIcon {
  cursor: move;
}
